#version 330 core
in vec2 TexCoord;
out vec4 FragColor;
uniform sampler2D texture1;
uniform sampler2D texture2;
uniform float self_alpha;
uniform float other_alpha;
void main() {
    vec4 color1 = texture(texture1, TexCoord);
    vec4 color2 = texture(texture2, TexCoord);
    color1.rgb *= color1.a;
    color2.rgb *= color2.a;
    color1 *= self_alpha;
    color2 *= other_alpha;
    FragColor = color2 + color1 * (1.0 - color2.a);
    FragColor.rgb /= FragColor.a;
    // FragColor = clamp(FragColor, 0.0, 1.0);
}